<?php 
namespace Admin\Controller;
use Think\Controller;
class CommonController extends Controller{
	// 无限极分类
	public function tree($arr,$pid=0,$level=0){
            static $tree = array();
            foreach($arr as $v){
                if($v['parent_id']==$pid){
                    //说明找到，保存
                    $v['level'] = $level;
                    $tree[] = $v;
                    //继续找
                    $this -> tree($arr,$v['cat_id'],$level+1);
                }
            }
            return $tree;
    }
}